/*
 * @Author: dfh
 * @Date: 2024-10-16 08:26:35
 * @LastEditors: dfh
 * @Modified By: dfh
 * @describe: 
 */
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_echarts/flutter_echarts.dart';

class TurnoverWidget extends StatelessWidget {
  final List<String> dataX;

  final List<String> dataY;

  const TurnoverWidget({super.key, required this.dataX, required this.dataY});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
       width: 300,
                height: 250,
      child: Echarts(
        option: '''
    {
      title: {
          text: '营业额统计',
          top:'3%',
          left:'3%'
      },
      xAxis: {
        type: 'category',
        data: ${jsonEncode(dataX)}
      },
      yAxis: {
        type: 'value'
      },
      series: [{
        data: ${jsonEncode(dataY)},
        type: 'line'
      }]
    }
  ''',
      ),
    );
  }
}
